/**
 * 
 */
package com.ez.supervise.service.impl;

import java.util.List;

import com.ez.supervise.core.Page;
import com.ez.supervise.dao.UserDao;
import com.ez.supervise.model.sys.User;
import com.ez.supervise.service.UserService;

/**
 * @author searph.wang
 * @email searph.wang@gmail.com
 * @Created at 2009-7-22
 * 
 */
public class UserServiceImpl implements UserService {
    private UserDao userDao;

    // public int update(User user) {
    // return sqlMapClientTemplate.update("sys.updateUser", user);
    // }

    public void setUserDao(UserDao userDao) {
	this.userDao = userDao;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#delete(java.lang.Long)
     */
    public void delete(Long id) {
	userDao.delete(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#insert(java.lang.Object)
     */
    public void insert(Object entity) {
	userDao.insert(entity);

    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#update(java.lang.Object)
     */
    public void update(Object entity) {
	userDao.update(entity);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#get(java.lang.Long)
     */
    public Object get(Long id) {
	return (User) userDao.get(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.ez.supervise.service.UserService#findByPage(com.ez.supervise.core
     * .Page)
     */
    public Page findByPage(Page page) {
	page.setRoot(userDao.findByPage(page));
	page.setTotalProperty(userDao.findByCount(page));
	return page;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.UserService#findAllUser()
     */
    public List findAllUser() {
	return userDao.findAllUser();
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.UserService#login(java.lang.String,
     * java.lang.String)
     */
    public User login(String userName, String password) {
	return userDao.login(userName, password);
    }

    public List findByOrg(Long orgId) {
	return userDao.findByOrg(orgId);
    }

    public void editPassword(User user) {
	userDao.editPassword(user);
    }
}
